<?php

namespace app\console;

use zhanshop\console\Command;
use zhanshop\console\Input;
use zhanshop\console\Output;
use zhanshop\client\Httpclient;

class TestProxy extends Command
{
    public function configure(){
        $this->useCache()->setTitle('test')->setDescription('测试代理');
    }

    public function execute(Input $input, Output $output)
    {
        $platform = $input->input("method", "请输入测试方法, 可选值(http,socks5)");
        $this->$platform();
    }

    public function http()
    {
        $httpClient = new Httpclient();
        $httpClient->httpproxy('127.0.0.1', 7280, 'root', "123456");
        $result = $httpClient->request("https://4.ipw.cn/");
        var_dump($result);
    }

    public function socks5()
    {
        $httpClient = new Httpclient();
        $httpClient->socks5('127.0.0.1', 7281, 'root', "123456");
        $result = $httpClient->request("https://4.ipw.cn/");
        var_dump($result);
    }
}
